package com.cmf.myproject.service.sysShortCut.dto;

import java.util.Date;

import org.apache.commons.lang3.StringUtils;

import lombok.Data;

@Data
public class SysShortCutQueryFilter{

	//自增序号
	private Long shortCutId;
	//快捷名称
	private String name;
	//快捷地址
	private String url;
	//是否可用
	private Boolean enable;
	//快捷类型
	private com.cmf.myproject.dal.mybatis.enums.SysShortCutOwnerTypeEnum ownerType;
	//
	private com.cmf.myproject.dal.mybatis.enums.SysShortCutOpenTypeEnum openType;
	//所属人ID
	private Long owerId;
	//快捷图标
	private String icon;
	//
	private Date createTime;
	//
	private Date updateTime;
	/**
	 * 
	 * jdbctype:timestamp
	 */
	private String createTimeStrStart;
	private String createTimeStrEnd;
	
	/**
	 * 
	 * jdbctype:timestamp
	 */
	private String updateTimeStrStart;
	private String updateTimeStrEnd;
	

	public String toQueryString() {
		StringBuilder param = new StringBuilder();
		/**
		 * jdbcType:bigint(20) unsigned
		 */
		if(getShortCutId() != null) {
			param.append("&shortCutId=");
			param.append(getShortCutId());
		}
		/**
		 * 快捷名称
		 * jdbcType:varchar(50)
		 */
		if(StringUtils.isNotBlank(getName())) {
			param.append("&name=");
			param.append(getName());
		}
		/**
		 * 快捷地址
		 * jdbcType:varchar(255)
		 */
		if(StringUtils.isNotBlank(getUrl())) {
			param.append("&url=");
			param.append(getUrl());
		}
		/**
		 * jdbcType:tinyint(1)
		 */
		if(getEnable() != null) {
			param.append("&enable=");
			param.append(getEnable());
		}
		/**
		 * jdbcType:enum('system','user')
		 */
		if(getOwnerType() != null) {
			param.append("&ownerType=");
			param.append(getOwnerType());
		}
		/**
		 * jdbcType:enum('system','linker')
		 */
		if(getOpenType() != null) {
			param.append("&openType=");
			param.append(getOpenType());
		}
		/**
		 * jdbcType:bigint(20)
		 */
		if(getOwerId() != null) {
			param.append("&owerId=");
			param.append(getOwerId());
		}
		/**
		 * 快捷图标
		 * jdbcType:varchar(30)
		 */
		if(StringUtils.isNotBlank(getIcon())) {
			param.append("&icon=");
			param.append(getIcon());
		}
		/**
		 * jdbcType:timestamp
		 */
		if(StringUtils.isNotBlank(getCreateTimeStrStart())) {
			param.append("&createTimeStrStart=");
			param.append(getCreateTimeStrStart());
		}
		if(StringUtils.isNotBlank(getCreateTimeStrEnd())) {
			param.append("&createTimeStrEnd=");
			param.append(getCreateTimeStrEnd());
		}
		/**
		 * jdbcType:timestamp
		 */
		if(StringUtils.isNotBlank(getUpdateTimeStrStart())) {
			param.append("&updateTimeStrStart=");
			param.append(getUpdateTimeStrStart());
		}
		if(StringUtils.isNotBlank(getUpdateTimeStrEnd())) {
			param.append("&updateTimeStrEnd=");
			param.append(getUpdateTimeStrEnd());
		}
//		if(param.length() > 0)
//			return "?"+param.toString().substring(1, param.length());
//		else
		return param.toString();
	}
	
	@Override
	public String toString() {
		return toQueryString();
	}
}
